package com.datas.beans;

import lombok.Getter;
import lombok.Setter;
import org.json.JSONObject;

/**
 * Created by jige0727 on 2017/4/5.
 * 登录的信息 登录失败可能返回的是 自己为null或者属性为null
 * <p>
 * 返回值-正常 获取到用户信息
 * {
 * "attributes" : {
 * "realname" : "管理员",	//姓名
 * "uid" : 1, 				//userid
 * "username" : "admin"	//账号
 * },
 * "id" : "admin"
 * }
 * <p>
 * 返回值-错误 返回错误信息
 * {
 * "error" : [ "expired_accessToken" ]
 * }
 */
@Getter
@Setter
public class LoginProfile {
    String realname;
    String username;
    Integer userId;

    public LoginProfile() {
    }

    public LoginProfile(String realname, String username, Integer userId) {
        this.realname = realname;
        this.username = username;
        this.userId = userId;
    }

    public JSONObject toJson() {
        return new JSONObject()
                .put("realname", realname)
                .put("uid", userId)
                .put("username", username);
    }
}
